package demo1.fac;

import demo1.dao.*;

/**
 * 工厂
 */
public class UserDaoFactory {
    public static UserDao getInstace(String key){
        switch (key){
            case "mysql":
                return new UserMysqlDaoImp();
            case "orcl":
                return new UserOrclDaoImp();
            case "redis":
                return new UserRedisDaoImp();
            case "sqlserver":
                return new UserSQLServerDaoImp();
            default:
                throw new RuntimeException("没有找到对应的数据库实现:"+ key);
        }
    }
}
